// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   AbstractDialog.java

package com.boci.common.ui;

import com.boci.clientapp.main.ApplicationService;
import com.boci.clientapp.main.TradingClientApp;
import com.boci.common.ui.control.DisclaimerPanel;
import com.boci.common.vo.ResponseVO;
import java.awt.*;
import java.awt.event.*;
import java.util.HashMap;
import java.util.Locale;
import javax.swing.*;

public abstract class AbstractDialog extends JDialog
    implements WindowListener, ActionListener, Runnable
{

    public void windowOpened(WindowEvent windowevent)
    {
    }

    public void windowClosed(WindowEvent windowevent)
    {
    }

    public void windowIconified(WindowEvent windowevent)
    {
    }

    public void windowDeiconified(WindowEvent windowevent)
    {
    }

    public void windowActivated(WindowEvent windowevent)
    {
    }

    public void windowDeactivated(WindowEvent windowevent)
    {
    }

    public void windowClosing(WindowEvent e)
    {
        ApplicationService.getInstance().setFocus();
    }

    public void run()
    {
        setLocationRelativeTo(mainFrame);
        refresh(null);
        super.setVisible(visibleFlag);
    }

    public void showDialog(boolean pVisible)
    {
        visibleFlag = pVisible;
        if(pVisible)
        {
            SwingUtilities.invokeLater(this);
        } else
        {
            super.setVisible(false);
            ApplicationService.getInstance().setFocus();
        }
    }

    public void hideDisclaimerPanel()
    {
        if(disclaimerPanel != null)
            disclaimerPanel.setVisible(false);
    }

    public AbstractDialog(TradingClientApp owner, boolean modal, Locale pLocale, boolean pShowDisclaimer)
    {
        super(owner, modal);
        setResizable(false);
        mainFrame = owner;
        super.getContentPane().setBackground(Color.WHITE);
        disclaimerPanel = new DisclaimerPanel(pLocale, true);
        contentPanel = new JPanel();
        super.getContentPane().setLayout(new BorderLayout());
        super.getContentPane().add(contentPanel, "Center");
        if(pShowDisclaimer)
            super.getContentPane().add(disclaimerPanel, "South");
        addWindowListener(this);
    }

    public Container getContentPane()
    {
        return contentPanel;
    }

    public Component add(Component comp)
    {
        if(contentPanel == null)
            return super.add(comp);
        else
            return contentPanel.add(comp);
    }

    public void add(Component comp, Object constraints)
    {
        if(contentPanel == null)
            super.add(comp, constraints);
        else
            contentPanel.add(comp, constraints);
    }

    public void setLayout(LayoutManager mgr)
    {
        if(contentPanel == null)
            super.setLayout(mgr);
        else
            contentPanel.setLayout(mgr);
    }

    public void setText(Locale pLocale)
    {
        disclaimerPanel.setText(pLocale);
    }

    public void setBusy(boolean pBusyFlag)
    {
        RootPaneContainer root = (RootPaneContainer)getRootPane().getTopLevelAncestor();
        if(pBusyFlag)
        {
            root.getGlassPane().setCursor(new Cursor(3));
            root.getGlassPane().addMouseListener(mouseAdapter);
            root.getGlassPane().setVisible(true);
            getContentPane().setCursor(new Cursor(3));
        } else
        {
            root.getGlassPane().setCursor(new Cursor(0));
            root.getGlassPane().removeMouseListener(mouseAdapter);
            root.getGlassPane().setVisible(false);
            getContentPane().setCursor(new Cursor(0));
        }
    }

    public abstract void refresh(ResponseVO responsevo);

    public abstract void actionPerformed(ActionEvent actionevent);

    public abstract HashMap getInputValue(String s);

    public abstract void setDefFocus();

    TradingClientApp mainFrame;
    JPanel contentPanel;
    DisclaimerPanel disclaimerPanel;
    boolean visibleFlag;
    private static final MouseAdapter mouseAdapter = new MouseAdapter() {

    }
;

}
